// pages/customerServiceOrderDetails/customerServiceOrderDetails.js
var app = getApp();
Page({

    /**
     * 页面的初始数据
     */
    data: {
        status: {
            1: "售后待审核",
            2: "售后处理中",
            3: "售后已完成",
            4: "售后已关闭"
        }
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var that = this;
        var goods_id = options.goods_id;
        that.get_customer_service_details(goods_id)
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    },//售后申请详情
    get_customer_service_details: function (goods_id) {
        var that = this;
        var params = {};
        params['product_id'] = goods_id;
        wx.request({
            url: app.config() + "order/orderDetailCustomization",
            data: params,
            header: {
                'content-type': 'application/json'
            },
            success: function (res) {
               
                if (res.data.status == 0) {
                    var data = res.data.data;
                    data['status_cn'] = that.data.status[data.status];
                    data['after_sale_create_time'] = app.to_time(data['after_sale_create_time']);
                    that.setData({
                        data: res.data.data
                    })
                }
            }
        })
    },//定制细节
    to_customDetail:function(e){
        var goods_id=e.currentTarget.dataset.goods_id;
        wx.navigateTo({
            url: '../../pages/customDetail/customDetail?order_id='+goods_id,
        })
    }
})